package com.zhuiyun.project.api.venuemanagement.controller;

import com.zhuiyun.project.annotation.OptLog;
import com.zhuiyun.project.api.venuemanagement.entity.BanRecord;
import com.zhuiyun.project.api.venuemanagement.model.VenueAddModel;
import com.zhuiyun.project.api.venuemanagement.model.VenueUpdateModel;
import com.zhuiyun.project.api.venuemanagement.service.VenueReviewService;
import com.zhuiyun.project.common.errorCode.CommonException;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.utils.constants.CommonConstants;
import com.zhuiyun.project.utils.pageUtil.PageRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName VenueReviewController
 * @Description TODO
 * @Author wuwan
 * @Date 2023/12/6 10:54
 **/
@RestController
@Api(tags = "场馆管理")
@Slf4j
@RequestMapping("/VenueReview")
public class VenueReviewController {
    @Autowired
    VenueReviewService venueReviewService;

    /*
     * @Author wuwan
     * @Description 查询所有未授权的场馆
     * @Date 2023/12/6 10:24
     * @Return
     */
    @GetMapping("/selectVenueReview")
    @ApiOperation(value = "查询所有未授权的场馆")
    @OptLog(modular = "场馆管理",type = CommonConstants.SELECT,describe = "查询所有未授权的场馆")
    public CommonResult selectVenueReview(PageRequest pageRequest, String userName, String phone){
        return CommonResult.ok(venueReviewService.selectVenueReview(pageRequest,userName,phone));
    }
    /*
     * @Author wuwan
     * @Description 添加场馆信息
     * @Date 2023/11/2 13:53
     * @Return
     */
    @PostMapping("/addVenueReview")
    @ApiOperation(value = "添加场馆信息")
    @OptLog(modular = "场馆管理",type = CommonConstants.ADD,describe = "添加场馆")
    public CommonResult addVenueReview(VenueAddModel venueAddModel, MultipartFile file) throws CommonException {
        log.info("新增场馆");
        return CommonResult.ok(venueReviewService.addVenueReview(venueAddModel,file));
    }
    /*
    * @Author wuwan
    * @Description 场馆账号授权
    * @Date 2023/12/7 9:16
    * @Return
    */
    @PutMapping("/upVenueReview")
    @ApiOperation(value = "场馆账号授权")
    @OptLog(modular = "场馆管理",type = CommonConstants.UPDATE,describe = "场馆账号授权")
    public CommonResult upVenueReview(@RequestBody  BanRecord banRecord){
        return CommonResult.ok(venueReviewService.upVenueReview(banRecord));
    }

}
